package com.runfast.waimai.web.controller;

import com.runfast.common.dao.model.RunfastCuseraddress;
import com.runfast.common.utils.TokenUtil;
import com.runfast.common.web.entity.Result;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 商家活动接口
 */
@RestController("userWmAddressController")
@RequestMapping(value= "/api/user/wm/address", headers = "token")
public class AddressController {

    /**
     * 获取当前用户的收货地址列表
     * @param token
     * @return
     */
    @PostMapping("/list")
    public Result<List<RunfastCuseraddress>> address(@RequestHeader String token) {
        Integer userId = TokenUtil.getUserId(token);


        return Result.ok("");
    }

    /**
     * 删除当前用户所属的收货地址
     * @param addressId
     * @param token
     * @return
     */
    @PostMapping("/delete")
    public Result<List<RunfastCuseraddress>> delete(@RequestParam int addressId, @RequestHeader String token) {
        Integer userId = TokenUtil.getUserId(token);


        return Result.ok("");
    }

    /**
     * 添加或者修改用户地址
     * @param cuseraddress
     * @param token
     * @return
     */
    @PostMapping("/addOrUpdate")
    public Result<List<RunfastCuseraddress>> update(@ModelAttribute RunfastCuseraddress cuseraddress, @RequestHeader String token) {
        Integer userId = TokenUtil.getUserId(token);


        return Result.ok("");
    }

}
